package sal.demo;

import java.io.IOException;
import java.util.ArrayList;

import org.kramaframework.event.MouseEvent;
import org.kramaframework.event.TEvent;
import org.kramaframework.event.TMouseEvent;
import org.kramaframework.exception.KramaUnknowJavascriptDependancyException;
import org.kramaframework.listener.TMouseListener;
import org.kramaframework.panel.TGlobalPanel;
import org.kramaframework.panel.TVerticalPanel;
import org.kramaframework.tag.widget.TLabel;
import org.kramaframework.view.TView;


/**
 * 
 * @author chabane
 *
 */
public class View extends TView {

	public void start(Object obj) throws IOException,	
			IllegalArgumentException {

		TGlobalPanel panel = new TGlobalPanel("mondiv", "global");
		panel.setWidth(400);
		
		TVerticalPanel hPanel = new TVerticalPanel("hPanel", "idHPanel");
		
		TLabel label = new TLabel("label", "bel");
		label.setText("ma label");
		label.setSize(40);
		
		label.addTMouseListener(new TMouseListener() {
			@Override
			public void onEvent(TEvent evt) {

				((TMouseEvent)evt).show("viewAjax", "operation", "valeur", new ArrayList() {
					{
						add(10);
						add(2);
						add("somme");
					}
				}, MouseEvent.ONCLICK);
			}
			
		}, label.getId());
		
		TLabel label2 = new TLabel("label2", "bel2");
		label2.setText("ma label2sssssssssssss");
		label2.setSize(30);
		
		hPanel.add(label);
		hPanel.add(label2);
		panel.add(hPanel);
		panel.setVisible(true);
	}
}
